#include <stdio.h>
#include <math.h>
#include <string.h>

//#define STDIN
//#define DEBUG

int n, m;


void process()
{
	const double p=acos(-1.0);
	double c1=log10(2*p);
	double c2=0.434294481903;
	double c3=log10(1.0*m);
	int s=1;
	if(m>3)
		s=(c3+c1)/2+m*(c3-c2)+1;
    printf("%d\n", s);
}

int main()
{
#ifdef STDIN
    freopen("bin/1423.in", "r", stdin);
#endif

    scanf("%d", &n);
    int i;
    for (i = 0; i < n; ++i)
    {
        scanf("%d", &m);
        process();
    }

    return 0;
}
